/*
 *  tm1638.h
 *
 *  Created on: Feb 11, 2020
 *      Author: Administrator
 *		Node  :
 */

#ifndef TM1638_TM1638_H_
#define TM1638_TM1638_H_

#ifdef __cplusplus
extern "C" {
#endif

/* 包含头文件
 * ------------------------------------------------------------------*/
#include "ch/bsp.h"
/* 类型定义
 * -------------------------------------------------------------------*/
#define digitalWrite( ... ) digitalWrite( __VA_ARGS__ )
/* 宏定义 --------------------------------------------------------------------*/

#ifdef ESP32
#define STB 19
#define CLK 18
#define DIO 32
#elif STM32
#define STB PA0
#define CLK PA1
#define DIO PA2
#endif

#define TM1638_SEG1 1
#define TM1638_SEG2 2
#define TM1638_SEG3 3
#define TM1638_SEG4 4

#define TM1638_SEG_ 10

/* 扩展变量
 * -------------------------------------------------------------------*/

/* 函数声明
 * -------------------------------------------------------------------*/
void TM1638_Init( void );
void TM1638_DisNumSeg( u8 seg, u8 num );
void TM1638_ClsSeg( u8 seg );  //清除某个SEG
void TM1638_ClsScreen();       //清屏

void TM1638_DisWeightGeSeg( u8 seg, u8 num );
void TM1638_DisWeightShiSeg( u8 seg, u8 num );

void TM1638_Test( void );

#ifdef __cplusplus
}
#endif

#endif /* TM1638_TM1638_H_ */
